Mule : Smtp Provider
This page last changed on Oct 25, 2006 by ross.
The Smtp transport provider can be used to for sending messages over Smtp and Smtps (secure) using the javax.mail api. The implementation supports CC/BCC/ReplyTo addresses, attachments, custom Header properties and customisable authentication. It also provides support for javax.mail.Message transformation. The javadoc for this provider can be found here , org.mule.providers.email.SmtpConnector org.mule.providers.email.SmtpsConnectorSmtp Connector Properties
Smtps Connector PropertiesThe Smtps Connector enables Smtp over SSL using the javax.mail APIs. It supports all the properties of the Smtp connector and has some additional properties for setting up an SSL connection.
When using the Smtps Connector the default port is set to 465. Smtp(s) EndpointsSmtp endpoints describe details about the Smtp server and the recipients of messages sent from the Smtp endpoint. Smtp URIs use the following syntax - smtp://[user:password@]<smtp server>[:port]?address=<recipient address> The format is the same for Smtps - smtps://[user:password@]<smtp server>[:port]?address=<recipient address>
For example, smtp://muletestbox:[email protected][email protected] Will send mail using smtp.mail.yahoo.co.uk (using default smtp port) to the address [email protected]. The Smtp request is authenticated using username muletestbox and password 123456. You will probably want to set other information such as subject and fromAddress. These can be set as parameters on the URI but we recommend you set them as endpoint properties to make it easier to read and maintain the configuration. <endpoint address="smtp://muletestbox:[email protected]? [email protected]"> <properties> <property name="fromAddress" value="[email protected]"/> <property name="ccAddresses" value="[email protected],[email protected]"/> <property name="subject" value="Please verify your ebay account details"/> </properties> </endpoint> So far, all configurations has been static in that you define all the information in the configuration of the endpoint. However, you can set the following properties on the MuleMessage to control the settings of the outgoing Smtp Message. These properties will override the endpoint properties -
If you always want to set the email address dynamically, you can leave out the address parameter on the Smtp endpoint. TransformersThere are a couple of transformers provided with the Email transport that are useful for converting Object payloads to javax.mail.Message types. These transformers adhere to the rules listed above and handle attachments too. If you need to customise the behaviour of these transformers it is recommended that you extends the existing transformers rather than re-implement them.
|
Document generated by Confluence on Nov 27, 2006 10:27 |